package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 商品订单详情表
 * </p>
 *
 * @author cnswhy
 * @since 2020-11-07
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_shop_order_detail")
@ApiModel(value = "ShopOrderDetail", description = "商品订单详情表")
@AllArgsConstructor
public class ShopOrderDetail extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 所属订单id
     */
    @ApiModelProperty(value = "所属订单id")
    @NotNull(message = "所属订单id不能为空")
    @TableField("order_id")
    @Excel(name = "所属订单id")
    private Long orderId;

    /**
     * 商品id
     */
    @ApiModelProperty(value = "商品id")
    @NotNull(message = "商品id不能为空")
    @TableField("product_id")
    @Excel(name = "商品id")
    private Long productId;

    /**
     * 库存id
     */
    @ApiModelProperty(value = "库存id")
    @TableField("stock_id")
    @Excel(name = "库存id")
    private Long stockId;

    /**
     * 商品名称
     */
    @ApiModelProperty(value = "商品名称")
    @NotEmpty(message = "商品名称不能为空")
    @Length(max = 200, message = "商品名称长度不能超过200")
    @TableField(value = "product_name", condition = LIKE)
    @Excel(name = "商品名称")
    private String productName;

    /**
     * 商品图片
     */
    @ApiModelProperty(value = "商品图片")
    @NotEmpty(message = "商品图片不能为空")
    @Length(max = 500, message = "商品图片长度不能超过500")
    @TableField(value = "product_img", condition = LIKE)
    @Excel(name = "商品图片")
    private String productImg;

    /**
     * 规格值组合，例如：红色,大码
     */
    @ApiModelProperty(value = "规格值组合，例如：红色,大码")
    @Length(max = 1000, message = "规格值组合，例如：红色,大码长度不能超过1000")
    @TableField(value = "spec_values", condition = LIKE)
    @Excel(name = "规格值组合，例如：红色,大码")
    private String specValues;

    /**
     * 商品单价
     */
    @ApiModelProperty(value = "商品单价")
    @NotNull(message = "商品单价不能为空")
    @TableField("cost_price")
    @Excel(name = "商品单价")
    private BigDecimal costPrice;

    /**
     * 商品编码
     */
    @ApiModelProperty(value = "商品编码")
    @NotEmpty(message = "商品编码不能为空")
    @Length(max = 50, message = "商品编码长度不能超过50")
    @TableField(value = "product_no", condition = LIKE)
    @Excel(name = "商品编码")
    private String productNo;

    /**
     * 实付金额
     */
    @ApiModelProperty(value = "实付金额")
    @NotNull(message = "实付金额不能为空")
    @TableField("amount")
    @Excel(name = "实付金额")
    private BigDecimal amount;

    /**
     * 数量
     */
    @ApiModelProperty(value = "数量")
    @NotNull(message = "数量不能为空")
    @TableField("num")
    @Excel(name = "数量")
    private Integer num;

    /**
     * 抵扣积分
     */
    @ApiModelProperty(value = "抵扣积分")
    @TableField("deduction_integral")
    @Excel(name = "抵扣积分")
    private BigDecimal deductionIntegral;

    /**
     * 状态：1-待发货 2-已发货 3-待退款 4-拒绝退款 5-已退款
     */
    @ApiModelProperty(value = "状态：1-待发货 2-已发货 3-待退款 4-拒绝退款 5-已退款")
    @NotNull(message = "状态：1-待发货 2-已发货 3-待退款 4-拒绝退款 5-已退款不能为空")
    @TableField("status")
    @Excel(name = "状态：1-待发货 2-已发货 3-待退款 4-拒绝退款 5-已退款")
    private Integer status;

    /**
     * 结算价
     */
    @ApiModelProperty(value = "结算价")
    @TableField("settlement_price")
    @Excel(name = "结算价")
    private BigDecimal settlementPrice;

    @ApiModelProperty(value = "")
    @Length(max = 255, message = "长度不能超过255")
    @TableField(value = "url", condition = LIKE)
    @Excel(name = "")
    private String url;
    @TableField(value = "sn", condition = LIKE)
    @Excel(name = "终端号")
    private String sn;


    @Builder
    public ShopOrderDetail(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long createUser, Long updateUser, 
                    Long orderId, Long productId, Long stockId, String productName, String productImg, 
                    String specValues, BigDecimal costPrice, String productNo, BigDecimal amount, Integer num, BigDecimal deductionIntegral, 
                    Integer status, BigDecimal settlementPrice, String url, String sn) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createUser = createUser;
        this.updateUser = updateUser;
        this.orderId = orderId;
        this.productId = productId;
        this.stockId = stockId;
        this.productName = productName;
        this.productImg = productImg;
        this.specValues = specValues;
        this.costPrice = costPrice;
        this.productNo = productNo;
        this.amount = amount;
        this.num = num;
        this.deductionIntegral = deductionIntegral;
        this.status = status;
        this.settlementPrice = settlementPrice;
        this.url = url;
        this.sn = sn;
    }

}
